const user = require('../service/user')

const getUserList = async(ctx)=>{
    let res = await user.getUserList(ctx.query)
    return ctx.body = {
        code:20000,
        data:res,
        msg:'获取成功'
    }
}

const userListAdd = async(ctx)=>{
    let res = await user.userListAdd(ctx.request.body)
    return ctx.body = {
        code:20000,
        data:res,
        msg:'新增成功'
    }
    // return ctx.body = {
    //     code:40001,
    //     msg:'拒绝新增'
    // }
}

// 删除
const userListDel = async(ctx)=>{
    let res = await user.userDelete(ctx.query)
    return ctx.body = {
        code:20000,
        data:res,
        msg:'删除成功'
    }
}

module.exports = {
    getUserList,
    userListAdd,
    userListDel
}